﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Portal.Core;
public partial class Ajax_Chatting : System.Web.UI.Page
{
    int IdComment_Flag = 0;
    Portal.Core.Ajax.Chatting chatting = new Portal.Core.Ajax.Chatting();
    protected void Page_Load(object sender, EventArgs e)
    {
        //Literal1.Text = ContentComment();
        string Contents = ContentComment();
        Response.Expires = -1;
        Response.Write(Contents);
    }
    public string ContentComment()
    {
        string Content = string.Empty;
        int IdComment = 0;
        string Id_User = string.Empty;
        string Content_comment = string.Empty;
        DataTable tb = chatting.ListCommentChatting(IdComment_Flag).Tables[0];
        if (tb.Rows.Count > 0)
        {
            for (int i = 0; i < tb.Rows.Count; i++)
            {
                IdComment = int.Parse(tb.Rows[i]["id_comment"].ToString());
                Id_User = tb.Rows[i]["id_user"].ToString();
                Content_comment = tb.Rows[i]["comment_content"].ToString();
                Content += "<div style='color:Red'><i>" + Id_User + "</i>:<b>" + Content_comment + "</b></div>";
                if (i == (tb.Rows.Count - 1))
                {
                    IdComment_Flag = IdComment;
                }
            }
        }
        return Content;
    }

}